import React from 'react'

const MyComponent = () => {
    console.log('MyComponent 更新了')
    return (
        <div>
        
        </div>
    )
}

const setSatisfactionClass = (level) => {
    if(level < 100) {
        return 'very-dissstatisfied';
    }
    if(level < 200) {
        return 'somewhat-dissatisdied';
    }
    if(level < 300) {
        return 'neither';
    }
    if(level < 400) {
        return 'somewhat-dissatisdied';
    }
    return 'very--dissatisdied'
}
// props level 参数给前后两个值
const isSameRange = (preveValue,nextValue) => {
    // console.log(preveValue,nextValue)
    const preveValueClass = setSatisfactionClass(preveValue.level);
    const nextValueClass = setSatisfactionClass(nextValue.level);
    // 返回true 不更新
    return preveValueClass === nextValueClass
}
// 
export default React.memo(MyComponent,isSameRange)